﻿using System;
using System.Drawing;
using System.Windows.Forms;
using FastColoredTextBoxNS;

namespace Flagwind.Utilities.DataBuilder
{
	public partial class FCodePreview : Form
	{
		#region 私有字段

		private string _content;

		#endregion

		#region 公共属性

		/// <summary>
		/// 获取预览内容。
		/// </summary>
		public string Content
		{
			get
			{
				return _content;
			}
			private set
			{
				_content = value;
			}
		}

		#endregion

		#region 构造方法

		/// <summary>
		/// 初始化 FCodePreview 类的新实例。
		/// </summary>
		/// <param name="content"></param>
		public FCodePreview(string content)
		{
			InitializeComponent();

			this.Content = content;
		}

		#endregion

		#region 事件方法

		private void FCodePreview_Load(object sender, EventArgs e)
		{
			var textBox = new FastColoredTextBox();
			textBox.Dock = DockStyle.Fill;
			textBox.Language = Language.CSharp;
			textBox.Font = new Font("Courier New", 11);
			textBox.TabLength = 4;
			textBox.Text = this.Content;

			this.Controls.Add(textBox);
		}

		#endregion
	}
}
